home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
dev
/
obero
/
oberon_lib.lha
/
oberon-a
/
source1.lha
/
source
/
Amiga
/
Trackdisk.mod
< prev
next >
Wrap
Text File
|
1994-08-08
|
9KB
|
272 lines
(**************************************************************************
$RCSfile: Trackdisk.mod $
Description: trackdisk device structure and value definitions
Created by: fjc (Frank Copeland)
$Revision: 3.2 $
$Author: fjc $
$Date: 1994/08/08 00:44:39 $
$VER: trackdisk.h 33.13 (28.11.90)
Includes Release 40.15
(C) Copyright 1985-1993 Commodore-Amiga, Inc.
All Rights Reserved
Oberon-A interface Copyright © 1994, Frank Copeland.
This file is part of the Oberon-A Interface.
See Oberon-A.doc for conditions of use and distribution.
***************************************************************************)
MODULE Trackdisk;
(*
** $C- CaseChk $I- IndexChk $L+ LongAdr $N- NilChk
** $P- PortableCode $R- RangeChk $S- StackChk $T- TypeChk
** $V- OvflChk $Z- ZeroVars
*)
IMPORT E := Exec;
(*
*--------------------------------------------------------------------
*
* Physical drive constants
*
*--------------------------------------------------------------------
*)
CONST
numSecs * = 11;
numUnits * = 4;
(*
*--------------------------------------------------------------------
*
* Useful constants
*
*--------------------------------------------------------------------
*)
CONST
(* -- sizes before mfm encoding *)
sector * = 512;
secShift * = 9; (* log tdSECTOR *)
(*
*--------------------------------------------------------------------
*
* Driver Specific Commands
*
*--------------------------------------------------------------------
*)
CONST
name * = "trackdisk.device";
extCom * = 08000H; (* for internal use only! *)
motor * = E.cmdNonstd+0; (* control the disk's motor *)
seek * = E.cmdNonstd+1; (* explicit seek (for testing) *)
format * = E.cmdNonstd+2; (* format disk *)
remove * = E.cmdNonstd+3; (* notify when disk changes *)
changeNum * = E.cmdNonstd+4; (* number of disk changes *)
changeState * = E.cmdNonstd+5; (* is there a disk in the drive? *)
protStatus * = E.cmdNonstd+6; (* is the disk write protected? *)
rawRead * = E.cmdNonstd+7; (* read raw bits from the disk *)
rawWrite * = E.cmdNonstd+8; (* write raw bits to the disk *)
getDriveType * = E.cmdNonstd+9; (* get the type of the disk drive *)
getNumTracks * = E.cmdNonstd+10; (* # of tracks for this type drive *)
addChangeInt * = E.cmdNonstd+11; (* tdREMOVE done right *)
remChangeInt * = E.cmdNonstd+12; (* remove softint set by ADDCHANGEINT *)
getGeometry * = E.cmdNonstd+13; (* gets the disk geometry table *)
eject * = E.cmdNonstd+14; (* for those drives that support it *)
lastComm * = E.cmdNonstd+15;
(*
*
* The disk driver has an "extended command" facility. These commands
* take a superset of the normal IO Request block.
*
*)
CONST
extWrite * = E.cmdWrite + extCom;
extRead * = E.cmdRead + extCom;
extMotor * = motor + extCom;
extSeek * = seek + extCom;
extFormat * = format + extCom;
extUpdate * = E.cmdUpdate + extCom;
extClear * = E.cmdClear + extCom;
extRawRead * = rawRead + extCom;
extRawWrite * = rawWrite + extCom;
(*
*
* extended IO has a larger than normal io request block.
*
*)
TYPE
IOExtTDPtr * = CPOINTER TO IOExtTD;
IOExtTD * = RECORD (E.IOStdReq)
count * : E.ULONG;
secLabel * : E.ULONG;
END; (* IOExtTD *)
(*
* This is the structure returned by tdDRIVEGEOMETRY
* Note that the layout can be defined three ways:
*
* 1. TotalSectors
* 2. Cylinders and CylSectors
* 3. Cylinders, Heads, and TrackSectors.
*
* #1 is most accurate, #2 is less so, and #3 is least accurate. All
* are usable, though #2 and #3 may waste some portion of the available
* space on some drives.
*)
TYPE
DriveGeometryPtr * = CPOINTER TO DriveGeometry;
DriveGeometry * = RECORD
sectorSize * : E.ULONG; (* in bytes *)
totalSectors * : E.ULONG; (* total # of sectors on drive *)
cylinders * : E.ULONG; (* number of cylinders *)
cylSectors * : E.ULONG; (* number of sectors/cylinder *)
heads * : E.ULONG; (* number of surfaces *)
trackSectors * : E.ULONG; (* number of sectors/track *)
bufMemType * : E.ULONG; (* preferred buffer memory type *)
(* (usually memfPUBLIC) *)
deviceType * : E.UBYTE; (* codes as defined in the SCSI-2 spec *)
flags * : E.BSET; (* flags, including removable *)
reserved * : E.UWORD;
END; (* DriveGeometry *)
CONST
(* device types *)
dgDirectAccess * = 0;
dgSequentialAccess * = 1;
dgPrinter * = 2;
dgProcessor * = 3;
dgWorm * = 4;
dgCDRom * = 5;
dgScanner * = 6;
dgOpticalDisk * = 7;
dgMediumChanger * = 8;
dgCommunication * = 9;
dgUnknown * = 31;
(* flags *)
dgRemovable * = 0;
(*
** raw read and write can be synced with the index pulse. This flag
** in io request's ioFLAGS field tells the driver that you want this.
*)
ioIndexSync * = 4;
(*
** raw read and write can be synced with a $4489 sync pattern. This flag
** in io request's ioFLAGS field tells the driver that you want this.
*)
ioWordSync * = 5;
(* labels are tdLabelSize bytes per sector *)
labelSize * = 16;
(*
** This is a bit in the FLAGS field of OpenDevice. If it is set, then
** the driver will allow you to open all the disks that the trackdisk
** driver understands. Otherwise only 3.5" disks will succeed.
*)
allowNon35 * = 0;
(*
** If you set the tdbAllowNon35 bit in OpenDevice, then you don't
** know what type of disk you really got. These defines are for the
** tdGETDRIVETYPE command. In addition, you can find out how many
** tracks are supported via the tdGETNUMTRACKS command.
*)
drive35 * = 1;
drive525 * = 2;
drive35150RPM * = 3;
(*
*--------------------------------------------------------------------
*
* Driver error defines
*
*--------------------------------------------------------------------
*)
CONST
errNotSpecified * = 20; (* general catchall *)
errNoSecHdr * = 21; (* couldn't even find a sector *)
errBadSecPreamble * = 22; (* sector looked wrong *)
errBadSecID * = 23; (* ditto *)
errBadHdrSum * = 24; (* header had incorrect checksum *)
errBadSecSum * = 25; (* data had incorrect checksum *)
errTooFewSecs * = 26; (* couldn't find enough sectors *)
errBadSecHdr * = 27; (* another "sector looked wrong" *)
errWriteProt * = 28; (* can't write to a protected disk *)
errDiskChanged * = 29; (* no disk in the drive *)
errSeekError * = 30; (* couldn't find track 0 *)
errNoMem * = 31; (* ran out of memory *)
errBadUnitNum * = 32; (* asked for a unit > NUMUNITS *)
errBadDriveType * = 33; (* not a drive that trackdisk groks *)
errDriveInUse * = 34; (* someone else allocated the drive *)
errPostReset * = 35; (* user hit reset; awaiting doom *)
(*
*--------------------------------------------------------------------
*
* public portion of the unit structure
*
*--------------------------------------------------------------------
*)
TYPE
PublicUnitPtr * = CPOINTER TO PublicUnit;
PublicUnit * = RECORD (E.Unit) (* base message port *)
comp01Track * : E.UWORD; (* track for first precomp *)
comp10Track * : E.UWORD; (* track for second precomp *)
comp11Track * : E.UWORD; (* track for third precomp *)
stepDelay * : E.ULONG; (* time to wait after stepping *)
settleDelay * : E.ULONG; (* time to wait after seeking *)
retryCnt * : E.UBYTE; (* # of times to retry *)
pubFlags * : E.BSET; (* public flags, see below *)
currTrk * : E.UWORD; (* track the heads are over... *)
(* ONLY ACCESS WHILE UNIT IS STOPPED! *)
calibrateDelay * : E.ULONG; (* time to wait after stepping *)
(* during a recalibrate *)
counter * : E.ULONG; (* counter for disk changes... *)
(* ONLY ACCESS WHILE UNIT IS STOPPED! *)
END; (* PublicUnit *)
CONST
(* flags for tduPubFlags *)
pbNoClick * = 0;
END Trackdisk.